package com.szcinda.fitness;

import com.szcinda.fitness.persistence.Appointment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDate;
import java.util.List;

public interface AppointmentRepository extends JpaRepository<Appointment, String> {

    @Query("select a from Appointment a where a.traineeOpenId = :traineeOpenId and a.appointmentDate>=:appointmentDate order by a.appointmentDate,a.appointmentTimeStart")
    List<Appointment> findByTraineeOpenId(@Param("traineeOpenId") String traineeOpenId,@Param("appointmentDate") LocalDate appointmentDate);

    List<Appointment> findByCoachOpenIdAndAppointmentDate(String coachOpenId, LocalDate appointmentDate);
}
